/*
 * Copyright (c) 2018. paascloud.net All Rights Reserved.
 * 项目名称：paascloud快速搭建企业级分布式微服务平台
 * 类名称：UacRoleService.java
 * 创建人：刘兆明
 * 联系方式：paascloud.net@gmail.com
 * 开源地址: https://github.com/paascloud
 * 博客地址: http://blog.paascloud.net
 * 项目官网: http://paascloud.net
 */

package com.csun.cmny.provider.service;


import com.csun.cmny.base.dto.LoginAuthDto;
import com.csun.cmny.core.support.IService;
import com.csun.cmny.provider.model.domain.UacRole;
import com.csun.cmny.provider.model.dto.action.ActionMainQueryDto;
import com.csun.cmny.provider.model.dto.menu.MenuQueryDto;
import com.csun.cmny.provider.model.dto.role.*;
import com.csun.cmny.provider.model.vo.BindAuthVo;
import com.csun.cmny.provider.model.vo.MenuVo;
import com.csun.cmny.provider.model.vo.RoleVo;
import com.csun.cmny.provider.model.vo.RpcRoleVo;
import com.github.pagehelper.PageInfo;

import java.util.List;


/**
 * The interface Uac role service.
 *
 * @author paascloud.net@gmail.com
 */
public interface UacRoleService extends IService<UacRole> {

	/**
	 * Find by role code uac role.
	 *
	 * @param roleCode the role code
	 *
	 * @return the uac role
	 */
	UacRole findByRoleCode(String roleCode);

	/**
	 * Query role list with page list.
	 *
	 * @param role the role
	 *
	 * @return the list
	 */
	List<RoleVo> queryRoleListWithPage(UacRole role);

	/**
	 * 根据角色删除用户.
	 *
	 * @param id the id
	 *
	 * @return the int
	 */
	int deleteRoleById(Long id);

	/**
	 * 保存用户.
	 *
	 * @param role         the role
	 * @param loginAuthDto the login auth dto
	 *
	 * @return the int
	 */
	int saveRole(UacRole role, LoginAuthDto loginAuthDto);

	/**
	 * Gets auth tree no check menu.
	 *
	 * @param roleId the role id
	 *
	 * @return the auth tree no check menu
	 */
	List<Long> getAuthTreeNoCheckMenu(Long roleId);

	/**
	 * Grant auth 4 role int.
	 *
	 * @param grantAuthRole the grant auth role
	 */
	void bindAction(RoleBindActionDto grantAuthRole);

	/**
	 * 根据角色Id获取角色信息.
	 *
	 * @param roleId the role id
	 *
	 * @return the role by id
	 */
	UacRole getRoleById(Long roleId);

	/**
	 * 角色绑定用户获取穿梭框信息.
	 *
	 * @param roleId        the role id
	 * @param currentUserId the current user id
	 *
	 * @return the role bind user dto by role id
	 */
	RoleBindUserDto getRoleBindUserDto(Long roleId, Long currentUserId);

	/**
	 * 角色绑定用户.
	 *
	 * @param roleBindUserReqDto the role bind user req dto
	 * @param loginAuthDto       the login auth dto
	 */
	void bindUser4Role(RoleBindUserReqDto roleBindUserReqDto, LoginAuthDto loginAuthDto);

	/**
	 * Find all role info by user id list.
	 *
	 * @param userId the user id
	 *
	 * @return the list
	 */
	List<UacRole> findAllRoleInfoByUserId(Long userId);

	/**
	 * Gets auth tree by role id.
	 *
	 * @param roleId the role id
	 *
	 * @return the auth tree by role id
	 */
	BindAuthVo getActionTreeByRoleId(Long roleId);

	/**
	 * Batch delete by id list int.
	 *
	 * @param idList the id list
	 */
	void batchDeleteByIdList(List<Long> idList);

	/**
	 * Gets own auth tree by role id.
	 *
	 * @param userId the user id
	 *
	 * @return the own auth tree by role id
	 */
	List<MenuVo> getOwnAuthTree(Long userId);

	/**
	 * Bind menu.
	 *
	 * @param roleBindMenuDto the role bind menu dto
	 */
	void bindMenu(RoleBindMenuDto roleBindMenuDto);

	/**
	 * Gets menu tree by role id.
	 *
	 * @param roleId the role id
	 *
	 * @return the menu tree by role id
	 */
	BindAuthVo getMenuTreeByRoleId(Long roleId);

	/**
	 * query role list by user id
	 *
	 * @param userId	user id
	 *
	 * @return	the list
	 */
	List<RpcRoleVo> queryRoleListByUserId(Long userId);

	/**
	 * 校验角色编码是否已经存在
	 *
	 * @param checkRoleCodeDto	the check role code dto
	 *
	 * @return the boolean true-不存在, false-存在
	 */
    boolean checkUacRoleCode(CheckRoleCodeDto checkRoleCodeDto);

	/**
	 * 校验角色名称是否已经存在
	 *
	 * @param checkRoleNameDto	the check role name dto
	 *
	 * @return	the boolean true-不存在 false-存在
	 */
	boolean checkUacRoleName(CheckRoleNameDto checkRoleNameDto);

	/**
	 * 修改角色信息
	 *
	 * @param uacRole	the uac role
	 *
	 * @return	the int
	 */
	Integer editUacRole(UacRole uacRole, LoginAuthDto loginAuthDto);

	/**
	 * 查询角色菜单列表
	 *
	 * @param menuQueryDto	role menu query dto
	 *
	 * @return	the page info.
	 */
    PageInfo queryRoleMenuListWithPage(MenuQueryDto menuQueryDto);

	/**
	 * 分配角色菜单
	 *
	 * @param roleAssignMenuDto
	 *
	 * @return
	 */
	Integer assignRoleMenu(RoleAssignMenuDto roleAssignMenuDto);

	/**
	 * 分配角色菜单
	 *
	 * @param roleAssignActionDto	分配角色功能对象
	 *
	 * @return	影响的行数
	 */
	Integer assignRoleAction(RoleAssignActionDto roleAssignActionDto);

	/**
	 * 查询角色功能列表
	 *
	 * @param actionMainQueryDto	the action main query dto
	 *
	 * @return	the page info
	 */
    PageInfo queryRoleActionListWithPage(ActionMainQueryDto actionMainQueryDto);

	/**
	 * 根据功能Id查询角色列表
	 *
	 * @param roleQueryDto	the role query dto
	 *
	 * @return	角色列表
	 */
	List<UacRole> queryActionRoleList(RoleQueryDto roleQueryDto);

	/**
	 * 分配功能角色
	 *
	 * @param actionAssignRoleDto	分配功能角色对象
	 *
	 * @return	影响的行数
	 */
	Integer assignActionRole(ActionAssignRoleDto actionAssignRoleDto);

	/**
	 * 通过用户ID查询角色详情
	 * @param userId
	 * @return
	 */
	List<RoleVo> selectByUserId(Long userId);
}
